// User Model
import { Model } from "@vuex-orm/core";
import Privacy from "./Privacy";
import Property from "./Property";
import Role from "./Role";
import RoleUser from "./RoleUser";
import Address from "./Address";
export default class User extends Model {
  // This is the name used as module name of the Vuex Store.
  static entity = "users";

  static primaryKey = "id";

  // List of all fields (schema) of the post model. `this.attr` is used
  // for the generic field type. The argument is the default value.
  static fields() {
    return {
      id: this.attr(null),
      username: this.attr(""),
      status: this.attr(""),
      locale: this.attr(""),
      follower: this.attr(""),
      following: this.attr(""),
      wachers: this.attr(""),
      roles: this.belongsToMany(Role, RoleUser, "user_id", "roles_id"),
      addresses: this.hasMany(Address, "user_id"),
      privacy: this.hasOne(Privacy, "user_id"),
      property: this.hasOne(Property, "user_id"),
      account_id: this.attr("")
    };
  }
}
